package b.d;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.Handler;
import android.util.Log;
import androidx.biometric.BiometricPrompt.d;
import androidx.biometric.DeviceCredentialHandlerActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import b.l.a.i;
import java.util.concurrent.Executor;

@SuppressLint({"SyntheticAccessor"})
/* compiled from: FingerprintHelperFragment */
public class e extends Fragment {
    public b W;
    public Executor X;
    public androidx.biometric.BiometricPrompt.b Y;
    public Handler Z;
    public boolean b0;
    public d c0;
    public Context d0;
    public int e0;
    public b.i.g.a f0;
    public final b.i.e.a.b.a g0 = new a();

    /* compiled from: FingerprintHelperFragment */
    public static class b {
        public final Handler a;

        public b(Handler handler) {
            this.a = handler;
        }

        public void a(int i) {
            this.a.obtainMessage(i).sendToTarget();
        }
    }

    /* compiled from: FingerprintHelperFragment */
    public class a extends b.i.e.a.b.a {

        /* compiled from: FingerprintHelperFragment */
        public class a implements Runnable {
            public final /* synthetic */ int a;
            public final /* synthetic */ CharSequence b;

            public a(int i, CharSequence charSequence) {
                this.a = i;
                this.b = charSequence;
            }

            public void run() {
                e.this.Y.a(this.a, this.b);
            }
        }

        public final void a(int i, CharSequence charSequence) {
            e.this.W.a(3);
            if (!j.a()) {
                e.this.X.execute(new a(i, charSequence));
            }
        }
    }

    public void E(Bundle bundle) {
        super.E(bundle);
        j0(true);
        this.d0 = k();
    }

    /* JADX WARNING: Removed duplicated region for block: B:38:0x0082  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x0042  */
    /* JADX WARNING: Removed duplicated region for block: B:24:0x0055  */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x004a  */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x004a  */
    /* JADX WARNING: Removed duplicated region for block: B:24:0x0055  */
    /* JADX WARNING: Removed duplicated region for block: B:12:0x002f  */
    /* JADX WARNING: Removed duplicated region for block: B:11:0x0029  */
    /* JADX WARNING: Removed duplicated region for block: B:24:0x0055  */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x004a  */
    public android.view.View G(android.view.LayoutInflater r10, android.view.ViewGroup r11, android.os.Bundle r12) {
        /*
        r9 = this;
        r10 = android.os.Build.VERSION.SDK_INT;
        r11 = r9.b0;
        r12 = 0;
        if (r11 != 0) goto L_0x00dc;
    L_0x0007:
        r11 = new b.i.g.a;
        r11.m486init();
        r9.f0 = r11;
        r11 = 0;
        r9.e0 = r11;
        r0 = r9.d0;
        r1 = 23;
        r2 = 1;
        if (r10 < r1) goto L_0x0026;
    L_0x0018:
        r3 = b.i.e.a.b.a(r0);
        if (r3 == 0) goto L_0x0026;
    L_0x001e:
        r3 = r3.isHardwareDetected();
        if (r3 == 0) goto L_0x0026;
    L_0x0024:
        r3 = 1;
        goto L_0x0027;
    L_0x0026:
        r3 = 0;
    L_0x0027:
        if (r3 != 0) goto L_0x002f;
    L_0x0029:
        r11 = 12;
        r9.o0(r11);
        goto L_0x0047;
    L_0x002f:
        if (r10 < r1) goto L_0x003f;
    L_0x0031:
        r3 = b.i.e.a.b.a(r0);
        if (r3 == 0) goto L_0x003f;
    L_0x0037:
        r3 = r3.hasEnrolledFingerprints();
        if (r3 == 0) goto L_0x003f;
    L_0x003d:
        r3 = 1;
        goto L_0x0040;
    L_0x003f:
        r3 = 0;
    L_0x0040:
        if (r3 != 0) goto L_0x0048;
    L_0x0042:
        r11 = 11;
        r9.o0(r11);
    L_0x0047:
        r11 = 1;
    L_0x0048:
        if (r11 == 0) goto L_0x0055;
    L_0x004a:
        r10 = r9.W;
        r11 = 3;
        r10.a(r11);
        r9.n0();
        goto L_0x00dc;
    L_0x0055:
        r11 = r9.c0;
        if (r11 != 0) goto L_0x005a;
    L_0x0059:
        goto L_0x0079;
    L_0x005a:
        r3 = r11.b;
        if (r3 == 0) goto L_0x0064;
    L_0x005e:
        r11 = new b.i.e.a.b$b;
        r11.m483init(r3);
        goto L_0x007a;
    L_0x0064:
        r3 = r11.a;
        if (r3 == 0) goto L_0x006e;
    L_0x0068:
        r11 = new b.i.e.a.b$b;
        r11.m482init(r3);
        goto L_0x007a;
    L_0x006e:
        r11 = r11.c;
        if (r11 == 0) goto L_0x0079;
    L_0x0072:
        r3 = new b.i.e.a.b$b;
        r3.m484init(r11);
        r11 = r3;
        goto L_0x007a;
    L_0x0079:
        r11 = r12;
    L_0x007a:
        r6 = 0;
        r3 = r9.f0;
        r4 = r9.g0;
        r8 = 0;
        if (r10 < r1) goto L_0x00da;
    L_0x0082:
        r10 = b.i.e.a.b.a(r0);
        if (r10 == 0) goto L_0x00da;
    L_0x0088:
        if (r3 == 0) goto L_0x00a7;
    L_0x008a:
        monitor-enter(r3);
        r0 = r3.b;	 Catch:{ all -> 0x00a4 }
        if (r0 != 0) goto L_0x009d;
    L_0x008f:
        r0 = new android.os.CancellationSignal;	 Catch:{ all -> 0x00a4 }
        r0.<init>();	 Catch:{ all -> 0x00a4 }
        r3.b = r0;	 Catch:{ all -> 0x00a4 }
        r1 = r3.a;	 Catch:{ all -> 0x00a4 }
        if (r1 == 0) goto L_0x009d;
    L_0x009a:
        r0.cancel();	 Catch:{ all -> 0x00a4 }
    L_0x009d:
        r0 = r3.b;	 Catch:{ all -> 0x00a4 }
        monitor-exit(r3);	 Catch:{ all -> 0x00a4 }
        r0 = (android.os.CancellationSignal) r0;
        r5 = r0;
        goto L_0x00a8;
    L_0x00a4:
        r10 = move-exception;
        monitor-exit(r3);	 Catch:{ all -> 0x00a4 }
        throw r10;
    L_0x00a7:
        r5 = r12;
    L_0x00a8:
        if (r11 != 0) goto L_0x00ab;
    L_0x00aa:
        goto L_0x00cf;
    L_0x00ab:
        r0 = r11.b;
        if (r0 == 0) goto L_0x00b7;
    L_0x00af:
        r0 = new android.hardware.fingerprint.FingerprintManager$CryptoObject;
        r11 = r11.b;
        r0.<init>(r11);
        goto L_0x00d0;
    L_0x00b7:
        r0 = r11.a;
        if (r0 == 0) goto L_0x00c3;
    L_0x00bb:
        r0 = new android.hardware.fingerprint.FingerprintManager$CryptoObject;
        r11 = r11.a;
        r0.<init>(r11);
        goto L_0x00d0;
    L_0x00c3:
        r0 = r11.c;
        if (r0 == 0) goto L_0x00cf;
    L_0x00c7:
        r0 = new android.hardware.fingerprint.FingerprintManager$CryptoObject;
        r11 = r11.c;
        r0.<init>(r11);
        goto L_0x00d0;
    L_0x00cf:
        r0 = r12;
    L_0x00d0:
        r7 = new b.i.e.a.a;
        r7.m480init(r4);
        r3 = r10;
        r4 = r0;
        r3.authenticate(r4, r5, r6, r7, r8);
    L_0x00da:
        r9.b0 = r2;
    L_0x00dc:
        return r12;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.d.e.G(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle):android.view.View");
    }

    public void m0(int i) {
        this.e0 = i;
        if (i == 1) {
            o0(10);
        }
        b.i.g.a aVar = this.f0;
        if (aVar != null) {
            synchronized (aVar) {
                if (aVar.a) {
                } else {
                    aVar.a = true;
                    Object obj = aVar.b;
                    if (obj != null) {
                        try {
                            ((CancellationSignal) obj).cancel();
                        } catch (Throwable th) {
                            synchronized (aVar) {
                                aVar.notifyAll();
                            }
                        }
                    }
                    synchronized (aVar) {
                        aVar.notifyAll();
                    }
                }
            }
        }
        n0();
    }

    public final void n0() {
        this.b0 = false;
        FragmentActivity e = e();
        i iVar = this.r;
        if (iVar != null) {
            b.l.a.a aVar = new b.l.a.a(iVar);
            aVar.e(this);
            aVar.k();
        }
        if (!j.a() && (e instanceof DeviceCredentialHandlerActivity) && !e.isFinishing()) {
            e.finish();
        }
    }

    public final void o0(int i) {
        if (!j.a()) {
            CharSequence string;
            androidx.biometric.BiometricPrompt.b bVar = this.Y;
            Context context = this.d0;
            if (i != 1) {
                switch (i) {
                    case 10:
                        string = context.getString(2131689923);
                        break;
                    case 11:
                        string = context.getString(2131689922);
                        break;
                    case 12:
                        string = context.getString(2131689920);
                        break;
                    default:
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.append("Unknown error code: ");
                        stringBuilder.append(i);
                        Log.e("FingerprintHelperFrag", stringBuilder.toString());
                        string = context.getString(2131689783);
                        break;
                }
            }
            string = context.getString(2131689919);
            bVar.a(i, string);
        }
    }

    public void p0(Handler handler) {
        this.Z = handler;
        this.W = new b(handler);
    }
}
